﻿using System;
using System.Collections;
using System.Configuration;
using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using System.Reflection;
using log4net;

namespace AnyOffice.general.system.log
{
    public partial class summary : ModulePage
    {
        private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
     
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                SysLogDao dao = new SysLogDao();
                DataTable table = dao.Statistic(base.Conn);
                if (table.Rows.Count > 0)
                {
                    this.litTotalDays.Text = (table.Rows[0]["TotalDays"] != DBNull.Value) ? table.Rows[0]["TotalDays"].ToString() : "0";
                    this.litTotalTimes.Text = (table.Rows[0]["TotalTimes"] != DBNull.Value) ? table.Rows[0]["TotalTimes"].ToString() : "0";
                    this.litYearTimes.Text = (table.Rows[0]["YearTimes"] != DBNull.Value) ? table.Rows[0]["YearTimes"].ToString() : "0";
                    this.litMonthTimes.Text = (table.Rows[0]["MonthTimes"] != DBNull.Value) ? table.Rows[0]["MonthTimes"].ToString() : "0";
                    this.litDayTimes.Text = (table.Rows[0]["DayTimes"] != DBNull.Value) ? table.Rows[0]["DayTimes"].ToString() : "0";
                    this.litDayAvgTimes.Text = (table.Rows[0]["DayAvgTimes"] != DBNull.Value) ? table.Rows[0]["DayAvgTimes"].ToString() : "0";
                }
                DataTable table2 = dao.SelectTop20(base.Conn);
                this.rptSysLog.DataSource = table2;
                this.rptSysLog.DataBind();
            }
            catch (Exception exception)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("", exception);
                }
            }
        } 

    }
}
